import Vue from 'vue'
import VueRouter from 'vue-router'
import LayoutPage from '../views/LayoutPage.vue'
import ArticleDetail from '../views/ArticleDetail.vue'
import ArticlePage from '../views/ArticlePage.vue'
import CollectPage from '../views/CollectPage.vue'
import LikePage from '../views/LikePage.vue'
import Userpage from '../views/UserPage.vue'

Vue.use(VueRouter)

const routes = [
  // 重定向
  {
    path: '/',
    redirect: '/home/article'
  },
  {
    path: '/home',
    component: LayoutPage,
    children: [
      {
        path: 'article',
        component: ArticlePage
      },
      {
        path: 'collect',
        component: CollectPage
      },
      {
        path: 'like',
        component: LikePage
      },
      {
        path: 'user',
        component: Userpage
      }
    ]

  },
  {
    name: 'ArticleDetail',
    path: '/detail',
    component: ArticleDetail
  }
]

const router = new VueRouter({
  routes
})

export default router
